package tv.youxing.android.custom;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;

import tv.youxing.android.R;

/**
 * Created by apple on 17/2/23.
 */

/**
 * 项目名：   Dbs
 * 包名：     com.lizi.dbs.view
 * 文件名：   CustomDialog
 * 创建者：   叶克武
 * 创建时间： 17/2/23 下午3:59
 * 描述：    自定义Dialog
 */
public class CustomDialog extends Dialog {

    //定义模版
    public CustomDialog(Context context, int layout, int style) {
        this(context, WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT,layout,style, Gravity.CENTER);
    }

    //定义属性
    public CustomDialog(Context context, int width, int height, int layout, int style, int gravity, int anim){
        super(context, style);

        setContentView(layout);
        Window window = getWindow();
        WindowManager.LayoutParams layoutParams = window.getAttributes();
        layoutParams.width = width;
        layoutParams.height = height;
        layoutParams.gravity = gravity;
        window.setAttributes(layoutParams);
        window.setWindowAnimations(anim);
    }

    //实例
    public CustomDialog(Context context, int width, int height, int layout, int style, int gravity){
        this(context,width,height,layout,style,gravity,R.style.pop_anim_style);
    }

}
